<%@page import="java.util.Date"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<head>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript">
	
</script>


</head>
<body>
	<c:if test="${cartUser.cartDetails.size() > 0}">
		<div class="CSSTableGenerator">
			<form:form method="post" action="checkout.html"
				modelAttribute="cartDetailForm">
				<table>
					<tr>
						<td>Mã sản phẩm</td>
						<td>Tên Sản Phẩm</td>
						<td>Số Lượng</td>
						<td>Đơn Giá</td>
						<td>Thành Tiền</td>
						<td>Tác Vụ</td>
					</tr>
					<c:forEach var="cartDetail" items="${cartDetailForm.cartDetails}"
						varStatus="status">
						<tr id="${cartDetail.productDetail.productDetailId}">
							<td><form:input readonly="true" type="text"
									value="${cartDetail.productDetail.productDetailId}"
									path="cartDetails[${status.index}].productDetail.productDetailId" /></td>
							<td>${cartDetail.productDetail.getName()}</td>
							<td><input type="text" value="${cartDetail.count}"
								name="cartDetails[${status.index}].count" /></td>
							<td>${cartDetail.productDetail.price}</td>
							<td>${cartDetail.productDetail.price * cartDetail.count}</td>
							<td><div>
									<a href="deleteItemInCart.html?id=${cartDetail.cartDetailId}"
										class="button">Xóa</a>
								</div></td>
						</tr>
					</c:forEach>
				</table>
				<br />
				<c:if test="${pageContext.request.userPrincipal.name == null}">
					<div class="form">
						<div>
							<label>Họ: </label>
							<form:input type="text" path="lastName" />
						</div>

						<div>
							<label>Tên: </label>
							<form:input type="text" path="firstName" />
						</div>

						<div>
							<label>Email: <em>*</em></label>
							<form:input type="text" path="email" />
						</div>

						<div>
							<label>Điện Thoại: </label>
							<form:input type="text" path="phone" />
						</div>

						<div>
							<label>Địa Chỉ:</label>
							<form:input type="text" path="address" />
						</div>
					</div>
				</c:if>

				<input type="submit" value="CheckOut" />

			</form:form>
		</div>

	</c:if>
</body>